﻿using System;
using System.Collections.Generic;

using EMan.Common.EnterpriseStructure;
using EMan.Common.WorkTasks;

using TrueCode.Core;

namespace Server.FunctionalTests.Dal.Helpers
{
  public static class Comparer
  {
    public static readonly IEqualityComparer< Department > Department = new LiteEqualityComparer< Department >(
      ( l, r ) => l.Id == r.Id && l.Revision == r.Revision && l.Title == r.Title && l.Description == r.Description );

    public static readonly IEqualityComparer< Job > Job =
      new LiteEqualityComparer< Job >(
        ( l, r ) => l.Id == r.Id && l.Revision == r.Revision && l.Title == r.Title && l.Description == r.Description );

    public static readonly IEqualityComparer< Employee > Employee = new LiteEqualityComparer< Employee >(
      ( l, r ) =>
      l.Id == r.Id && l.Revision == r.Revision && l.Firstname == r.Firstname && l.NickName == r.NickName &&
      l.Surname == r.Surname && l.Secondname == r.Secondname );

    public static readonly IEqualityComparer< WorkTask > WorkTask =
      new LiteEqualityComparer< WorkTask >(
        ( l, r ) =>
        l.Id == r.Id && l.Revision == r.Revision && l.Summary == r.Summary && l.FullText == r.FullText &&
        ( l.DueDate - r.DueDate ) < TimeSpan.FromSeconds( 1 ) );
  }
}